﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
   
    <ControlTemplate x:Key="MouseOverButton"  TargetType="{x:Type Button}">
        <Grid Background="{TemplateBinding Background}">
            <Border Name="PlaceHolder" Margin="0,0,2,2"
                    HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
                    VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}">
                <Grid Name="Normal">
                    <ContentPresenter Margin="{TemplateBinding Control.Padding}"
                                      HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
                                      VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
                                      RecognizesAccessKey="True" />
                </Grid>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Cursor" Value="Hand"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="Normal" Property="Margin" Value="2,2,0,0"/>
                <Setter TargetName="PlaceHolder" Property="Margin" Value="0,0,0,0" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.5" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type Button}" x:Key="MouseOverButtonStyle">
        <Setter Property="Background"
                Value="Transparent"></Setter>
        <Setter Property="Template"
                Value="{StaticResource MouseOverButton}"></Setter>
    </Style>

    <ControlTemplate x:Key="MouseOverToggleButton"  TargetType="{x:Type ToggleButton}">
        <Grid Background="Transparent">
            <Border Name="PlaceHolder" Margin="0,0,2,2"
                    HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
                    VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
                    Background="Transparent">
                <Grid Name="Normal" Background="Transparent">
                    <ContentPresenter Margin="{TemplateBinding Control.Padding}"
                                      HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
                                      VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
                                      RecognizesAccessKey="True" />
                </Grid>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Cursor" Value="Hand"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="Normal" Property="Margin" Value="2,2,0,0"/>
                <Setter TargetName="PlaceHolder" Property="Margin" Value="0,0,0,0" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.5" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type ToggleButton}"
           x:Key="MouseOverToggleButtonStyle">
        <Setter Property="Background"
                Value="Transparent"></Setter>
        <Setter Property="Template"
                Value="{StaticResource MouseOverToggleButton}"></Setter>
    </Style>

    <Style TargetType="{x:Type Button}" x:Key="TransparentButtonStyle">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border Background="Transparent">
                        <ContentPresenter/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>